<template>
  <tbody>
    <tr v-for="(item, index) in arr" :key="index">
      <td><input type="checkbox" v-model="item.checked" /></td>
      <td>{{ item.name }}</td>
      <td>
        {{ item.price }}
      </td>
      <td>
        <button @click="item.num > 0 ? item.num-- : 0">-</button>
        {{ item.num }}
        <button @click="item.num++">+</button>
      </td>
      <td>{{ item.price * item.num }}</td>
      <td><button @click="delFn(index)">删除</button></td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: ["arr"],
  methods: {
    delFn(index) {
      this.$emit("del", index);
    },
  },
};
</script>

<style>
</style>